package com.ruben.state.example;

import java.util.Map;

/**
 * 审核操作类
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/10/17 18:52
 */
public class ApprovalExecutor {

    private ApprovalStatus status;

    public ApprovalExecutor(ApprovalStatus status) {
        this.status = status;
    }

    /**
     * 变更状态
     *
     * @param status 状态
     */
    public void changeStatus(ApprovalStatus status) {
        this.status = status;
        status.setExecutor(this);
    }

    /**
     * 审核
     *
     * @param param 参数
     * @return 结果
     */
    public Map<String, Object> execute(Map<String, Object> param) {
        return status.execute(param);
    }

}
